<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = "hello";
        // 字符串遍历接口
        for(var i of str){
            console.log(i);
        }

        for(let i=0 ;i<str.length;i++){
            console.log(str[i]);
        }
       
        // 动态创建一个A标签，A标签href属性也是动态的
        var href = "https://baidu.com";
        var text = "百度"

        // 向页面动态写入标签的时候，标签的数据一般来源于服务器

        var baidu = "<a href = '"+href+"'>"+text+"</a>";
        console.log(baidu);

         //模板字符串
         var baidu1 = `<a href = "${href}">${text}</a>`;
         console.log(baidu);
    </script>
</body>
</html>